<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Notification extends Model
{
    use HasFactory, SoftDeletes;
    
    protected $fillable = ['type', 'category', 'title', 'data', 'read_at'];
    protected $casts = ['data' => 'array', 'read_at' => 'datetime'];
    
    const CATEGORY_SYSTEM = 'system';
    const CATEGORY_ORDER = 'order';
    const CATEGORY_AFTER_SALES = 'after_sales';
    
    public function notifiable()
    {
        return $this->morphTo();
    }
}
